<?php

namespace Crc\Entity;

use Doctrine\ORM\Mapping AS ORM,
    Doctrine\Common\Annotations\AnnotationRegistry;

/**
 *
 *
 * @ORM\Entity
 * @ORM\Table(name="acl_right")
 */

class AclRight
{
    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="AclRole", inversedBy="rights")
     * @ORM\JoinColumn(name="id_acl_role", referencedColumnName="id")
     */
    private $role;

    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="AclResource", inversedBy="rights")
     * @ORM\JoinColumn(name="id_acl_resource", referencedColumnName="id")
     */
    private $resource;

    /**
     * @ORM\Column(type="integer")
     */
    private $permision;

    public function setRole(AclRole $_role)
    {
        $_role->addRights($this);
        $this->role = $_role;
        return $this;
    }

    public function getRole()
    {
        return $this->role;
    }

    public function setResource(AclResource $_resource) {
         $_resource->addRights($this);
         $this->resource = $_resource;
         return $this;
    }

    public function getResource()
    {
        return $this->resource;
    }

    public function setPermision($_permision)
    {
        $this->permision = $_permision;
        return $this;
    }

    public function getPermision()
    {
        return $this->permision;
    }
}